
<extend name="Public/layout"/>
<block name="head">
  <link rel="stylesheet" href="__PUBLIC__css/circle-opinion.css?A=<php>echo time()</php>">
<script src="__PUBLIC__js/circle.js"></script>
<script src="__PUBLIC__js/yi-scroll.js"></script>
<style type="text/css">
.footer{
  display: none;
}
</style>
</block>
  <block name="main">
      <div class="circle-person clearfix">
        <div class="item-top">
            <div class="item-right">
              <img src="{$info.user.url_img}"  onclick="location.href='/Home/person/center/id/{$info.user.id}'">
              <div class="user">
                <h4>{$info.user.nickname}</h4>
                <img src="__PUBLIC__images/ad-star.png">
                 <!--<if condition="$grade.is_invest eq 1">
                  <p>已投</p>
                </if>-->
              </div>
              <div class="comment">
                 <ul>
                  <!--   <volist name="info.tag" id="v" offset="0" length='3'>
                    <li>
                      <span>{$v}</span>
                    </li>
                  </volist> -->
                  </ul>
              </div>
            </div>
                <switch name="grade.colligate" >
                <case value="1" break="1"><div class="btn-sug"></div></case>
                <case value="2"><div class="btn-set"></div> </case>
                <case value="3"><div class="btn-pru"></div> </case>
                <case value="4"><div class="btn-no"></div> </case>
                </switch> 
        </div>
        <div class="item-bottom">
         <div class="platform-one clearfix">
            <div class="platform-title">
              <p>舆情解读</p>
            </div>
            <div class="platform-item">
              <a href="{$info.url}">
                <!-- <div class="opinion-img">
                  <img src="">
                </div> -->
                <div class="opinion-content">
                  <h4>{$info.title}</h4>
                  <a href="{$info.url}">{$info.url}</a>
                </div>
              </a>
            </div>
            <div class="opinion-form clearfix">
              <p>来源：{$info.source}</p>
            </div>
          </div>
          <div class="platform-com">
            <p>
            {$info.content}
            </p>
          </div>
          
        </div>
        <div class="item-time">
          <p>{$info.add_date}</p>
        </div>
        <div class="item-cite">
          <p <if condition="$_SESSION['user']['id'] gt 0"> onclick="location.href='/home/Circle/circle_opinion/id/{$_GET[platform_id]}/url/{:base64_encode($info[url])}/title/{:base64_encode($info[title])}/source/{:base64_encode($info[source])}'"<else/>onclick="isnologin()"</if> >引用解读</p>
        </div>
        <div class="item-left left-top">
           <if condition="$info.is_praise eq 0">
              <div class="item-no" onclick="praise(this,8,{$info.id})">
                 <img src="__PUBLIC__images/comment-no.png" height="26" width="28">
            <else/>
              <div class="item-good"  onclick="praise(this,8,{$info.id})">
                 <img src="__PUBLIC__images/comment-good.png" height="26" width="28">
            </if>

            <span>{$info.praise}</span>
          </div>
        </div>
  </div>
  <div class="circle-comment">
    <div class="comment-title">
      <h4>评论</h4>
      <p>{$info.comment}</p>
    </div>
    <div class="comment-item">
     <ul>
        <foreach name="comment" item="v">
         <li>
            <a href="javascript:" class="clearfix">
                <div class="item-top">
                    <div class="item-right">
                      <img src="{$v.user.url_img}">
                      <div class="user">
                        <h4>{$v.user.nickname}</h4>
                      </div>
                    </div>
               </div>
                <div class="item-bottom">
                  <p>{$v.content}</p>
                </div>
                <div class="item-time">
                  <p>{$v.add_date}</p>
                </div>
                <div class="item-left">
                  <if condition="$v.is_praise eq 0">
                    <div class="item-no" onclick="comment_praise(this,{$v.id})">
                      <img src="__PUBLIC__images/comment-no.png" height="26" width="28">
                  <else/>
                    <div class="item-good" onclick="comment_praise(this,{$v.id})">
                      <img src="__PUBLIC__images/comment-good.png" height="26" width="28">
                  </if>
                    
                    <span>{$v.praise_count}</span>
                  </div>
                 <div class="item-com"  onclick="comment_tab({$_GET['id']},{$v.id},{$v.id})" >
                    <img src="__PUBLIC__images/comment.png" height="25" width="28">
                    <span>回复</span>
                  </div>

                </div>
             </a>
        
              <ul>
                <foreach name="v.kid" item="va">
                <li>
                  <a href="#" class="clearfix">
                        <div class="item-top">
                            <div class="item-right">
                               <img src="{$va.user.url_img}">
                              <div class="user">
                                 <h4>{$va.user.nickname}</h4>
                              </div>
                            </div>
                       </div>
                        <div class="item-bottom">
                          <p>@{$v.user.nickname}：{$va.content}</p>
                        </div>
                        <div class="item-time">
                          <p>{$va.add_date}</p>
                        </div>
                     </a>
                </li>
                </foreach>
              </ul>
          </li>
        </foreach>  
      </ul>
  </div>
  </div>
  <!-- 我要说两句 -->
  <div class="bottom-item">
  <p class="comment-inp" onclick="comment_tab({$_GET['id']},0,0)" >我要说两句</p>
  </div>
  <!-- 评论输入框 -->
<div class="comment-info">
    <div class="comment-title">
          <h4>发表评论</h4>
          <img class="comment-hidden" src="__PUBLIC__images/bottom.png">
    </div>
    <div class="content">
      <textarea class="comment-textarea" cols="5" type="text" maxlength="200" placeholder="您已实名认证，请根据您的情况作出实际评价，不造谣，不夸大。一旦发现评论出现恶意造谣等虚假信息，将对评论本人进行曝光，封号处理，如有违法，将提交公安机关处理。" autofocus="true"></textarea>
      <p class="comment-send">发送</p>
    </div>
</div>
</block>
<block name="js">
    <script type="text/javascript">
  function isnologin(){
        layer.open({
                    content: '请先登录！'
                    , skin: 'msg'
                    , time: 1
                    , end: function () {
                        location.href = "/Home/User/login?callback=/Home/Circle/circle_opinion_info/id/{$_GET['id']}/platform_id/{$_GET['platform_id']}"
                    }
                });
      }
        function comment_praise(obj,id){
    $.post('{:U("Praise/ajax_praise")}',{
                id:id,
                video_id:id,
                type:3,
            },function(res){
              console.log(res)
               if(res.err==0){
                  $(obj).removeClass('item-no')
                  $(obj).addClass('item-good')
                  $(obj).find('img').attr('src','/App/Home/Public/images/comment-good.png')
                  var num = $(obj).find('span').text()
                  var n =parseInt(num)+1
                  $(obj).find('span').text(n)

               }else if(res.err==2){
                    layer.open({
                      content: res.msg
                      ,skin: 'msg'
                      ,time: 1
                      ,end: function () {
                              location.href = "/Home/User/login?callback=/Home/circle/commentary_info/id/{$_GET['id']}/platform_id/{$_GET['platform_id']}"
                            }
                      });
               }else{
                    layer.open({
                      content: res.msg
                      ,skin: 'msg'
                      ,time: 1
                      });
               }
    })
  }
  function praise(obj,type,id){
        var userid = "{$_SESSION['user']['id']}"
         if(!userid){
            layer.open({
                    content: '请先登录！'
                    , skin: 'msg'
                    , time: 1
                    , end: function () {
                        location.href = "/Home/User/login?callback=/Home/circle/commentary_info/id/{$_GET['id']}/platform_id/{$_GET['platform_id']}"
                    }
                });
        }
          $.post('/Home/Praise/ajax_praise',{
            opinionid:id,
            id:id,
            type:type,
          },function(res){
            if(res.err==0){
              $(obj).removeClass('item-no')
              $(obj).addClass('item-good')
              $(obj).find('img').attr('src','/App/Home/Public/images/comment-good.png')
              var num=parseInt($(obj).find('span').text())
              num = num+1
              $(obj).find('span').text(num)
            }else{
              layer.open({
                    content: res.msg
                    , skin: 'msg'
                    , time: 1
                    
              });
            }
          })
        
  }

      function comment_tab(id,id_parent,pid){
          $('.comment-info').css('display','block');
          $('.comment-send').attr('onclick',"add_coments(this,1,"+id_parent+","+pid+")")
        }
      $('.comment-hidden').click(function(){
        $('.comment-info').css('display','none');
      });


      //发表评论
    function add_coments(obj,type,id_parent,pid){
      var userid = "{$_SESSION['user']['id']}"
         if(!userid){
            layer.open({
                    content: '请先登录！'
                    , skin: 'msg'
                    , time: 1
                    , end: function () {
                        location.href = "/Home/User/login?callback=/Home/circle/commentary_info/id/{$_GET['id']}/platform_id/{$_GET['platform_id']}"
                    }
                });
            return;
        }
      if(!id_parent){
          var id_parent=0;
      }
      var id_target = "{$_GET['id']}";

      var content = $(obj).prev('Textarea').val();
      if(!content){
          layer.open({
            content:'请输入评论内容！'
            ,skin: 'msg'
            ,time: 1
          });
                   return;
      }
    $.post('{:U("comment/add_coments")}',{
        content:content,
        id_parent:id_parent,
        type:6,
        id_target:id_target,
        p_id:pid,
        target_title:'{$info.title}',
    },function(res){
        if(res.err==0){
            $(obj).prev().val('');
            //ajax 无刷新添加评论
            if(type==1){
                 layer.open({
                content: res.msg
                ,skin: 'msg'
                ,time: 1
                ,end:function(){location.reload()}
                });
            }else{
                layer.open({
                    content: res.msg
                    ,skin: 'msg'
                    ,time: 1
                    ,end:function(){$(obj).parent().parent('.comment-info').css('display','none');}
                });
            }

            if(type==2){
            }
           
        }else{
            layer.msg(res.msg)
        }
        
    })
}
    var colligate = '{$grade.colligate}';
    
    if(colligate==1){
      var title="放心投-{$platform_name}舆情解读"
    }else if(colligate==2){
      var title="可以投-{$platform_name}舆情解读"
    }else if(colligate==3){
      var title="谨慎投-{$platform_name}舆情解读"
    }else if(colligate==4){
      var title="不要投-{$platform_name}舆情解读"
    }
    
    var desc = '{$info.user.nickname}--舆情解读！'
    var link=window.location.href
    var imgUrl='http://wei.8hjie.com/App/Home/Public/images/chat-icon.png' 
    

  

    </script>
</block>